package ratonTalk;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author ：Dsi
 * @date ：2021/11/18 19:26
 * Describe ：该类用于对SimpleDateFormat的使用说明
 */
public class SimpleDateFormaTest {
    public static void main(String[] args) throws ParseException {
        Date date=new Date();
        SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String d = sdf.format(date);
        System.out.println(d);

        String s="2021-02-12 11:45:23";
        Date a = sdf.parse(s);
        System.out.println(a);
        System.out.println();

        Date d1=DateUtil.stringToDate("2020-10-09 20:54:30","yyyy-MM-dd HH:mm:ss");
        System.out.println(d1);
    }
}
